package com.static_;

/**
 * @Author 小闽
 * @Date 2024/9/5 16:41
 * @PackageName: com.static_
 * @ClassName: StaticExercise01
 * @Description: 练习1
 * @Version 1.0
 */
public class StaticExercise01 {
    public static void main(String[] args) {
        new Test().count(); // count = 9
        new Test().count(); // count = 10
        // 通过类名去调用静态变量
        System.out.println(Test.count); // count = 11
    }
}

class Test{
    // 静态变量count = 9
    static int count = 9;
    // 非静态方法count
    public void count(){
        System.out.println("count=" + (count++)); // count = 9
    }
}